# encoding: utf-8
import sys
import time


from urlConfig.urlList import update_online_state_url
from utils.http import do_request


def update_state():
    while True:
        time.sleep(5)

        from config import settings
        if not settings.IsLogined:
            continue
        if not settings.IsClosed:
            sys.exit(0)
        if len(settings.jwtToken) == 0:
            continue
        headers = {
            "Authorization": settings.jwtToken
        }
        response = do_request(method="get", url=update_online_state_url, headers=headers)
        if response:
            # print(response.json())
            pass
        else:
            continue
